﻿<?php
session_start();
include("admin_resist_mdl.php");
?>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<?php

include("../../Modules/conn.php");

$mscb_old = $_GET["mscb"];
$mscb_new = $_POST["txtMSCB"];
$tencb = $_POST["txtTenCB"];
$msbm = $_POST["cboBM"];

// Kiem tra mscb
$queryMSCB = "select * from giang_vien where MSCB = '$mscb_new' and MSCB <> '$mscb_old'";
$resultMSCB = mysql_query($queryMSCB, $conn) or die(mysql_error());
$count = mysql_num_rows($resultMSCB);

if ($count > 0)
{
	header("Location: ../View/admin_cpanel.php?part=editgv&mscb=$mscb_old&info=dupmscb");
}
else
{
	// Sua thong tin giang vien
	$queryUpdGV = "update giang_vien set MSCB = '$mscb_new', MSBM = '$msbm', TEN_CB = '$tencb' where MSCB = '$mscb_old'";
	mysql_query($queryUpdGV, $conn) or die(mysql_error());
	
	mysql_close();
	header("Location: ../View/admin_cpanel.php?info=editgvsucc");
}

?>